package com.mk.admin.service.impl;

import com.mk.admin.mapper.*;
import com.mk.admin.model.*;
import com.mk.admin.model.dto.*;
import com.mk.admin.model.entity.*;
import com.mk.admin.model.vo.*;
import com.mk.admin.service.*;
import com.mk.admin.util.*;
import org.springframework.beans.factory.annotation.*;
import org.springframework.stereotype.*;

import java.util.*;


@Service
public class DoctorPatientServiceImpl implements DoctorPatientService {
    @Autowired
    private  DoctorPatientMapper doctorPatientMapper;

    @Autowired
    private  PatientTagMapper patientTagMapper;

    @Override
    public ResultDto select(DoctorPatientVo vo) {
        DoctorPatientEntity entity = JSONCopy.copy(vo,DoctorPatientEntity.class);
        PatientTagEntity tagEntity = JSONCopy.copy(vo,PatientTagEntity.class);
        List<DoctorPatientDto> list = doctorPatientMapper.select(entity);
        for (int i = 0; i < list.size(); i++) {
            /*通过患者id查询患者标签*/
            tagEntity.setPatId(list.get(i).getPatId());
            List<PatientTagDto> listTag = patientTagMapper.select(tagEntity);
            list.get(i).setPatTag(listTag);
        }
        return ResultDto.data(list);
    }
}
